<?php
error_reporting(0);
$username = isset($_POST['username'])?$_POST['username']:"";
$password = isset($_POST['password']) ? md5($_POST['password']) :md5();

require_once("database.php");
$sql = "SELECT * FROM gps_user WHERE username='".$username."' AND password = '".$password."'";
$checkLogin = query($db,$sql);
session_start();
if(!empty($checkLogin))
{
  $_SESSION['username'] = $username;
  $_SESSION['isLogin'] = true;
  $data = ['code'=>200,'message'=>'成功','data'=>[]];
}else{
	$data = ['code'=>201,'message'=>'登录失败','data'=>[]];
}
echo json_encode($data);
